<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="icon" href="https://static.nowcoder.com/images/logo_87_87.png"/>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
          crossorigin="anonymous">
    <link rel="stylesheet" th:href="@{/css/global.css}"/>
    <title>管理后台</title>
</head>
<body>
<div class="nk-container">
    <!-- 头部 -->
    <header class="bg-dark sticky-top" th:replace="index::header">
    </header>

    <!-- 内容 -->
    <div class="main">
        <div class="container">
            <!-- 选项 -->
            <div class="position-relative">
                <ul class="nav nav-tabs">
                    <li class="nav-item">
                        <a class="nav-link active" th:href="@{/admin/index}">权限管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/admin/data}">网站数据</a>
                    </li>
                </ul>
            </div>
            <!--弹出框 -->
            <div class="modal fade" id="publishModal" tabindex="-1" role="dialog" aria-labelledby="publishModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content" style="border-radius: 10px">
                        <div class="modal-header">
                            <h5 class="modal-title" style="font-weight: lighter" id="publishModalLabel">添加管理员</h5>
                            <button type="button" class="close btn" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body align-self-center" style="font-weight: lighter;padding: 30px 5px">
                            <label for="username" class="col-form-label">用户名：</label>
                            <input type="text" name="username" onchange="UsernameChange()" style="font-weight: lighter" id="username"><br>
                            <span id="hint" style="font-size: 12px;color: red"></span>
                        </div>
                        <div class="modal-footer">
                            <button type="button" style="font-weight: lighter" class="btn btn-secondary"
                                    data-dismiss="modal">取消
                            </button>
                            <button type="button" style="font-weight: lighter" class="btn btn-primary" id="addBtn">
                                添加
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <!--提示框-->
            <div class="modal fade" id="hintModal" tabindex="-1" role="dialog" aria-labelledby="hintModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" style="font-weight: lighter" id="hintModalLabel">提示</h5>
                        </div>
                        <div class="modal-body align-self-center" style="font-weight: lighter;padding: 50px 5px" id="hintBody">
                        </div>
                    </div>
                </div>
            </div>
            <div style="padding: 20px 20px 10px">
                <button  class="btn btn-sm btn-info float-right" data-toggle="modal" data-target="#publishModal">添加管理员</button>
                <span class="text-muted font-size-16">管理员列表</span>
            </div>

            <div th:if="${users.size()==0}" style="padding-top: 50px;padding-bottom: 50px;text-align: center">
                <span class="text-muted font-size-14" style="font-weight: lighter">空空如也~</span><br/>
                <img th:src="@{/img/nothing.png}" >
            </div>

            <ul class="list-unstyled" style="padding: 10px 20px">
                <li class="media pb-3 pt-3 mb-3 border-bottom position-relative" th:each="user:${users}">
                    <a th:href="@{|/user/profile/${user.id}|}">
                        <img th:src="${user.headerUrl}"
                             class="mr-4 rounded-circle user-header" alt="用户头像">
                    </a>
                    <div class="media-body big-bottom">
                        <div>
                            <button type="button" th:onclick="cancleAdmin([[${user.username}]],[[${user.id}]]);" class="btn btn-sm float-right follow-btn btn-danger">取消管理员</button>
                            <h6 class="mt-0 mb-3">
                                <span class="text-success" th:utext="${user.username}">落基山脉下的闲人</span>
                            </h6>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>

    <!-- 尾部 -->
    <footer class="bg-dark" th:replace="index::footer">
    </footer>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
        crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script th:src="@{/js/global.js}"></script>
<script th:src="@{/js/admin.js}"></script>
</body>
</html>
